﻿<!DOCTYPE html>
<html lang="zh-CN">
<head>
    <meta charset="UTF-8">
    <title>最新通知</title>
    @Html.Partial("~/Views/Share/PublicHeader.cshtml")
</head>
<body>
    @Html.Partial("~/Views/Share/PublicTopNav.cshtml")
    <div class="container">
        <div class="row">
            <h1 class="topTitle-h1">@ViewData["CourseName"] 
                <br>
                <small>广州中医药大学康复治疗微课程网络学习平台</small>
            </h1>
        </div>
    </div>
    @Html.Partial("~/Views/Share/PublicNav.cshtml", this.ViewData)
    <div class="container wrap mb10">
        <div class="row">
            <div class="col-xs-9">
                <div class="lBox part">
                    <div class="lBox-th">
                        <h3>最新通知</h3>
                    </div>
                    <div class="lBox-tb">
                        <table class="table table-striped table-hover" style="margin-top: -10px;">
                            <thead>
                                <tr>
                                    <th width="60%">标题</th>
                                    <th width="20%">作者</th>
                                    <th width="20%">发表日期</th>
                                </tr>
                            </thead>
                            <tbody id="tbody">
                                 
                            </tbody>
                        </table>
                        <div class="row clearfix well d-page">
                            <div id="PagInfo" class="pull-left sum">
                            </div>
                            <div class="clearfix pull-right">
                                <ul id="PageTool" class="pagination"></ul>
                            </div>
                        </div>
                    </div>
                </div>
            </div>

            <div class="col-xs-3">
                @Html.Partial("~/Views/Share/PublicNewestAnnounce.cshtml")
                @Html.Partial("~/Views/Share/PublicNewestDiscuss.cshtml")
            </div>
        </div>
    </div>
    @Html.Partial("~/Views/Share/PublicFooter.cshtml")
    @Html.Partial("~/Views/Share/PublicCommonJs.cshtml")
    <script>
        var tbody = $("#tbody");
        var options = false;
        var _state = false;
        var _courseId = "@ViewData["CourseId"]";
        function getList(pageNo) {

            $("#PagInfo").html("");
            $("#PageTool").html("");

            $.easyPost("/Announce/GetAnnounceInfoList", { "PageNO": pageNo, "PageSize": "10", "CourseId": _courseId, "IsStop": false },
               function (data) {
                   if (!data.result) {
                       alert(data.message);
                       return;
                   }
                   var _html = '';
                   if (data.rows.length > 0) {
                       $(".d-page").show();

                       var _row = data.rows,
                           _rowL = _row.length;
                       options = {
                           totalPages: data.totalPage,
                           total: data.total,
                           currentPage: pageNo,
                           onPageClicked: function (event, originalEvent, type, page) {
                               getList(page);
                           }
                       }
                       initialPaginator(options, "PageTool", "PagInfo");

                       for (var i = 0; i < _rowL; i++) {
                           var item = _row[i];
                           var _date = item.CreateTime.toString().replace(/\//g, "");
                           var time = eval('new ' + _date);
                            
                           _html += "<tr>";
                           _html += "<td>";
                           _html += "<a target='_blank' href='/Announce/AnnounceInfoDetail?Id=" + item.Id + "'>" + item.Title + "</a>";
                           _html += "</td>";
                           _html += "<td>" + item.Creator + "</td>";
                           _html += "<td>" + time.format('yyyy-MM-dd') + "</td>";
                           
                           _html += "</tr>";
                       }
                   }
                   else {
                       _html = "<tr><td colspan='3' align='center'>暂无内容!</tr>";
                       $(".d-page").hide();
                   }
                   tbody.html(_html);
               }, "json");
        }


        if (!!window.location.hash) {
            var _hash = window.location.hash.substr(1);
            getList(_hash);
        } else {
            getList(1);
        }


    </script>
</body>
</html>
